package com.nf.health.app.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.nf.health.app.R;

import java.util.List;

public class SchemeDetailAdapter extends BaseAdapter {
	private Context context;
	private List<String> lvDataList;

	public SchemeDetailAdapter(Context context, List<String> lvDataList) {
		this.context = context;
		this.lvDataList = lvDataList;
	}

	@Override
	public int getCount() {
		return lvDataList.size();
	}

	@Override
	public Object getItem(int id) {
		return lvDataList.get(id);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View view, ViewGroup ViewGroup) {
		ViewHolder holder;
		if (view == null) {
			view = View.inflate(context, R.layout.activity_scheme_datails_item,
					null);
			holder = new ViewHolder();

			holder.tv_aim = (TextView) view.findViewById(R.id.tv_aim);

			view.setTag(holder);

		} else {
			holder = (ViewHolder) view.getTag();
		}

		holder.tv_aim.setText((position + 1) + ",  "
				+ lvDataList.get(position).toString());

		return view;
	}

	static class ViewHolder {
		TextView tv_aim;
	}
}
